package com.soul.model;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.JSON;

@Setter
@Getter
@Builder
public class RequestDataDTO {

    /**
     * 请求环境
     */
    private String apiName;

    /**
     * token
     */
    @JSONField(name = "tokenid")
    private String tokenId;

    /**
     * 请求数据主体
     */
    private com.alibaba.fastjson.JSONObject reqData;

    public static String generate(String apiName, String tokenId, String applyData) {
        com.alibaba.fastjson.JSONObject applyJson = JSON.parseObject(applyData);
        return com.alibaba.fastjson.JSONObject
            .toJSONString(RequestDataDTO.builder().apiName(apiName).tokenId(tokenId).reqData(applyJson).build());
    }
}